<div id="bd">
  <div id="yui-main" class="content">
    <div class="yui-b first">
    <b class="btop"><b></b></b>
      {if $user->cat_username}
        <div class="resulthead"><h3>{translate text='Your Holds and Recalls'}</h3></div>
        <div class="page">

        {if is_array($cancelResults)}
          {foreach from=$cancelResults item=system key=syskey}
            {if $system.sysmessage}
            <h4>{translate text=$syskey}</h4>  
            <p>{translate text="hold_cancel_success"}</p>
            {/if}
          {/foreach}
         
        {else}
        {if $cancelResults == "success"}
          <p>{translate text="hold_success"}</p>
        {/if}
        {/if}
        
          {if is_array($recordList)}

            {if $cancelForm == "true"}
              <form name="cancelAll" action="{$url|escape}/MyResearch/Holds" method="POST" id="cancelAll">
                <div>
                  <div class="cancelall">
                {foreach from=$recordList item=system key=syskey}
                  {foreach from=$system item=resource name="recordLoop"}
                    {if $resource.ils_details.cancel_details}<input type="hidden" name="cancelHold[]" value="{$resource.ils_details.cancel_details|escape}" />{/if}
                  {/foreach}
                {/foreach}
                  <input type="submit" name="cancelall" value="{translate text="Cancel All Holds"}" />
                </div> 
                </div>
              </form>
            
              <form name="cancelForm" action="{$url|escape}/MyResearch/Holds" method="POST" id="cancelHold">
            {/if}
            
        {foreach from=$recordList item=system key=syskey name="systemLoop"}
        <h4>{translate text=$syskey}</h4>
        <ul class="filters">
        {foreach from=$system item=resource name="recordLoop"}
          {if ($smarty.foreach.recordLoop.iteration % 2) == 0}
          <li class="result alt">
          {else}
          <li class="result">
          {/if}
            <div class="yui-ge">
              <div class="yui-u first">
                <img src="{$path}/bookcover.php?isn={$resource.isbn.0|@formatISBN}&amp;size=small" class="alignleft">

                <div class="resultitem">
                  <a href="{$url}/Record/{$resource.id|escape:"url"}" class="title">{$resource.title|escape}</a><br>
                  {if $resource.author}
                  {translate text='by'}: <a href="{$url}/Author/Home?author={$resource.author|escape:"url"}">{$resource.author|escape}</a><br>
                  {/if}
                  {if $resource.tags}
                  {translate text='Your Tags'}:
                  {foreach from=$resource.tags item=tag name=tagLoop}
                    <a href="{$url}/Search/Results?tag={$tag->tag|escape:"url"}">{$tag->tag|escape}</a>{if !$smarty.foreach.tagLoop.last},{/if}
                  {/foreach}
                  <br />
                  {/if}
                  {if $resource.notes}
                  {translate text='Notes'}: {$resource.notes|escape}<br>
                  {/if}

                  {if is_array($resource.format)}
                    {foreach from=$resource.format item=format}
                      <span class="iconlabel {$format|lower|regex_replace:"/[^a-z0-9]/":""}">{translate text=$format}</span><br />
                    {/foreach}
                    {if $format == "Journal" || $format == "Serial"}
                      {assign var='useVol' value='true'}
                    {/if}
                  {else}
                    <span class="iconlabel {$resource.format|lower|regex_replace:"/[^a-z0-9]/":""}">{translate text=$resource.format}</span><br />
                    {if $resource.format == "Journal" || $resource.format == "Serial"}
                      {assign var='useVol' value='true'}
                    {/if}
                  {/if}
                  {if $useVol == "true"}
                    {if $resource.ils_details.volume}
                      <strong>{translate text='Volume'}:</strong> {$resource.ils_details.volume}<br />
                    {/if}
                    {if $resource.ils_details.publication_year}
                      <strong>{translate text='Publication Year'}:</strong> {$resource.ils_details.publication_year}<br />
                    {/if}
                  {/if}
                  {foreach from=$pickup key=key item=library}
                    {if $library.libid == $resource.ils_details.location}
                      <strong>{translate text='pick_up_location'}:</strong> {$library.libname|escape}
	                  <br />
                    {/if}
                  {/foreach}
                  <strong>{translate text='Created'}:</strong> {$resource.ils_details.createdate|escape} |
                  <strong>{translate text='Expires'}:</strong> {$resource.ils_details.expiredate|escape}
                  <br />
                  {if $resource.ils_details.position}
                  <strong>{translate text='queue_position'}:</strong> {$resource.ils_details.position|escape}
                  <br />
                  {/if}
                    {if $resource.ils_details.cancel_details}
                      {translate text='Cancel Hold'}: <input type="checkbox" name="cancelHold[]" value="{$resource.ils_details.cancel_details}" class="cancelcheck" />
                    {elseif $resource.ils_details.cancel_link}
                      <a href="{$resource.ils_details.cancel_link|escape}">{translate text='Cancel Hold'}</a> 
                    {/if}
                </div>
              </div>
            </div>
          </li>
        {/foreach}
        </ul>
        {/foreach}
        
        {if $cancelForm == "true"}
          <br />
          <input type="submit" name="cancel" value="{translate text="Cancel Selected Holds"}" />
          </form>
        {/if}
        
        {else}
        {translate text='holds_none'}.
        {/if}
      {else}
        <div class="page">
        {include file="MyResearch/catalog-login.tpl"}
      {/if}</div>
    <b class="bbot"><b></b></b>
    </div>
  </div>

  {include file="MyResearch/menu.tpl"}

</div>
